<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../vue.js"></script>
</head>

<body>
  <div id="app">
    <p>数字{{num}}</p>
    <h1>{{msg}}</h1>
    <button @click="num = 1">新闻</button>
    <button @click="num = 2">娱乐</button>
    <button @click="num = 3">体育</button>
    <button @click="num = 4">生活</button>
    <!-- v-show也是需要接收一个boolean 决定当前元素时display：none还是block -->
    <ul v-show="num===1">
      <li>新闻</li>
    </ul>
    <ul v-show="num===2">
      <li>娱乐</li>
    </ul>
    <ul v-show="num===3">
      <li>体育</li>
    </ul>
    <ul v-show="num===4">
      <li>生活</li>
    </ul>
  </div>
  <script>
    Vue.config.productionTip = false;
    const vm = new Vue({
      el: "#app",
      data() {
        return {
          msg: "hello vue!",
          num: 1
        }
      },
      methods: {}
    })
  </script>
</body>

</html>